import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// import TableControls from '#cpt/temp/TableControls'
// ===================================================================== global declare
const { $http } = window
// ===================================================================== Lazy
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
		selectedKeys:[],
		//修改账期
		formData:[
			{ label: '账期',			name: 'summary_sn', 			disabled:true, width:'33%' },
			{ label: '账单金额',		name: 'bill_price', 			disabled:true, width:'33%' },
			{ label: '收款金额',		name: 'collection_price', 		disabled:true, width:'33%' },
			{ label: '未收款金额',	name: 'not_collection_price',	disabled:true, width:'33%' },
			{ label: '回款日期',		name: 'collection_date', 		disabled:true, width:'33%' },
			{ label: '受检单位',		name: 'hosp_name', 				disabled:true, width:'33%' },
			{ label: '开票单位',		name: 'organization_name',  	disabled:true, width:'33%' },
			{ label: '区域',			name: 'region_name', 			disabled:true, width:'33%' },
			{ label: '业务员',		name: 'salesman_user', 			disabled:true, width:'33%' },
			{ label: '备注',			name: 'remark', 				disabled:true, type:'textarea', full:true },
		]
	}
	
	model = {}
	uuid = null
	type = 1
	open = ({uuid,summary_sn,hosp_id,type}) => {
		const { formData } = this.state
		this.type = type
		this.uuid = uuid
		if(type===1){
			formData[4].label = '回款日期'
		}else{
			formData[4].label = '退款日期'
		}
		this.setState({formData})
		this.formRef.setValue({uuid,summary_sn,hosp_id})
		$http.submit(this,'fi-pay-book/info',{param:{uuid,summary_sn,hosp_id}}).then(data=>{
			this.formRef.setValue(data)
		})
		this.modal.open({ formRef:this.formRef })
	}
 	render(){
		const title = this.type===1?'查看回款日期':'查看退款日期'
		return FormModal.call(this,{ title,labelWidth:'s11', width:'50%', noOk:true, noCancel: true,
			close:()=>{
				this.setState({data:[]})
			}
		 })
	}
}

export default Index